import request from '@/utils/request'
let serviceName="/admin-service"
/**
 * 登录函数
 * @param {} website 
 */
export function login(login) {
    return request({ url: serviceName+"/index/login", method: "post", params: login });
}

/**
 * 获取分页数据
 * @param { } keyword 
 */
export function getAdmins(keyword) {
    return request({ url: serviceName+ "/admin/list", method: "post", data: keyword });
}
/**
 * 更新
 * @param {*} id 
 */
export function update(admin){
    return  request({ url: serviceName+"/admin/update", method: "post",data: admin});
}
/**
 * 删除
 * @param {*} id 
 */
export function remove(id){
    return  request({ url: serviceName+"/admin/delete", method: "post",params:{"id":id}});
}
/**
 * 根据ID获取
 * @param {*} id 
 */
export function getAdmin(id){
    return  request({ url: serviceName+"/admin/getById", method: "get",params:{"id":id}});
}
/**
 * 添加用户
 * @param {*} admin
 */
export function insert(admin) {
    return request({ url: serviceName+"/admin/insert", method: "post", data: admin });
}
/**
 * 根据管理员名字重置密码
 * @param {*} admin
 */
export function updateByUsername(admin){
    return request({url:serviceName+"/admin/updateByName",method:"post",data:admin})
}
/**
 * 根据用户名获取
 * @param {*} username
 */
export function getByName(username){
    return request({url:serviceName+"/admin/getByName?username="+username,method:"get",params:username})
}